/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package library;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 *
 * @author TECHNOLOGIES
 */
@Entity
@Table(name = "library", catalog = "collegeaccountant", schema = "")
@NamedQueries({
    @NamedQuery(name = "Library.findAll", query = "SELECT l FROM Library l"),
    @NamedQuery(name = "Library.findByStudentID", query = "SELECT l FROM Library l WHERE l.studentID = :studentID"),
    @NamedQuery(name = "Library.findByRegistrationFee", query = "SELECT l FROM Library l WHERE l.registrationFee = :registrationFee"),
    @NamedQuery(name = "Library.findByFine", query = "SELECT l FROM Library l WHERE l.fine = :fine"),
    @NamedQuery(name = "Library.findByLibrarianID", query = "SELECT l FROM Library l WHERE l.librarianID = :librarianID"),
    @NamedQuery(name = "Library.findByBookMagazineOrdered", query = "SELECT l FROM Library l WHERE l.bookMagazineOrdered = :bookMagazineOrdered"),
    @NamedQuery(name = "Library.findByVendor", query = "SELECT l FROM Library l WHERE l.vendor = :vendor"),
    @NamedQuery(name = "Library.findByCostPerPrice", query = "SELECT l FROM Library l WHERE l.costPerPrice = :costPerPrice"),
    @NamedQuery(name = "Library.findByQty", query = "SELECT l FROM Library l WHERE l.qty = :qty")})
public class Library implements Serializable {
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "StudentID")
    private String studentID;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "RegistrationFee")
    private Float registrationFee;
    @Column(name = "Fine")
    private Float fine;
    @Column(name = "LibrarianID")
    private String librarianID;
    @Column(name = "Book_Magazine_Ordered")
    private Integer bookMagazineOrdered;
    @Column(name = "Vendor")
    private String vendor;
    @Column(name = "CostPerPrice")
    private Float costPerPrice;
    @Column(name = "Qty")
    private Integer qty;

    public Library() {
    }

    public Library(String studentID) {
        this.studentID = studentID;
    }

    public String getStudentID() {
        return studentID;
    }

    public void setStudentID(String studentID) {
        String oldStudentID = this.studentID;
        this.studentID = studentID;
        changeSupport.firePropertyChange("studentID", oldStudentID, studentID);
    }

    public Float getRegistrationFee() {
        return registrationFee;
    }

    public void setRegistrationFee(Float registrationFee) {
        Float oldRegistrationFee = this.registrationFee;
        this.registrationFee = registrationFee;
        changeSupport.firePropertyChange("registrationFee", oldRegistrationFee, registrationFee);
    }

    public Float getFine() {
        return fine;
    }

    public void setFine(Float fine) {
        Float oldFine = this.fine;
        this.fine = fine;
        changeSupport.firePropertyChange("fine", oldFine, fine);
    }

    public String getLibrarianID() {
        return librarianID;
    }

    public void setLibrarianID(String librarianID) {
        String oldLibrarianID = this.librarianID;
        this.librarianID = librarianID;
        changeSupport.firePropertyChange("librarianID", oldLibrarianID, librarianID);
    }

    public Integer getBookMagazineOrdered() {
        return bookMagazineOrdered;
    }

    public void setBookMagazineOrdered(Integer bookMagazineOrdered) {
        Integer oldBookMagazineOrdered = this.bookMagazineOrdered;
        this.bookMagazineOrdered = bookMagazineOrdered;
        changeSupport.firePropertyChange("bookMagazineOrdered", oldBookMagazineOrdered, bookMagazineOrdered);
    }

    public String getVendor() {
        return vendor;
    }

    public void setVendor(String vendor) {
        String oldVendor = this.vendor;
        this.vendor = vendor;
        changeSupport.firePropertyChange("vendor", oldVendor, vendor);
    }

    public Float getCostPerPrice() {
        return costPerPrice;
    }

    public void setCostPerPrice(Float costPerPrice) {
        Float oldCostPerPrice = this.costPerPrice;
        this.costPerPrice = costPerPrice;
        changeSupport.firePropertyChange("costPerPrice", oldCostPerPrice, costPerPrice);
    }

    public Integer getQty() {
        return qty;
    }

    public void setQty(Integer qty) {
        Integer oldQty = this.qty;
        this.qty = qty;
        changeSupport.firePropertyChange("qty", oldQty, qty);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (studentID != null ? studentID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Library)) {
            return false;
        }
        Library other = (Library) object;
        if ((this.studentID == null && other.studentID != null) || (this.studentID != null && !this.studentID.equals(other.studentID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "library.Library[ studentID=" + studentID + " ]";
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }
    
}
